package com.pai4j.pgc.service.event.listener;
import com.pai4j.pgc.service.community.StudyHistoryService;
import com.pai4j.pgc.service.event.CourseStudyEvent;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;

/**
 *
 *
 * @author: CYM-pai
 * @date: 2025/10/27 20:13
 **/
@Component
public class CourseStudyListener implements ApplicationListener<CourseStudyEvent> {


    @Autowired
    private StudyHistoryService studyHistoryService;

    @Override
    public void onApplicationEvent(CourseStudyEvent event) {

        studyHistoryService.add(event.getUserid(), event.getResourceType(), event.getResourceId());
    }
}
